home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat4 / quotas.z / quotas
Encoding:
Text File  |  2001-04-17  |  16.5 KB  |  331 lines

  1.  
  2.  
  3.  
  4. qqqquuuuoooottttaaaassss((((4444))))                                                            qqqquuuuoooottttaaaassss((((4444))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      quotas - filesystem quota subsystem
  10.  
  11. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  12.      In most computing environments, disk space is not infinite.  The
  13.      lbootable qqqquuuuoooottttaaaassss subsystem provides a mechanism to control usage of disk
  14.      space.  Quotas can be set for each individual user on any or all of the
  15.      local filesystems.  The quotas subsystem warns users when they exceed
  16.      their allotted limit, but allows some extra space for current work (hard
  17.      limit/soft limit).  In addition, XFS filesystems with limit enforcement
  18.      turned off can be used as an effective disk usage accounting system.
  19.  
  20.    UUUUsssseeeerrrrssss'''' VVVViiiieeeewwwwssss ooooffff DDDDiiiisssskkkk QQQQuuuuoooottttaaaassss
  21.      To most users, disk quotas are either of no concern or a fact of life
  22.      that cannot be avoided.  There are two possible quotas that can be
  23.      imposed; usually if one is imposed, both are.  A limit can be set on the
  24.      amount of space a user can occupy, and there may be a limit on the number
  25.      of files (inodes) he can own.
  26.  
  27.      The _q_u_o_t_a(1) command provides information on the quotas that have been
  28.      set by the system administrators and current usage.
  29.  
  30.      There are four numbers for each limit:  current usage, soft limit
  31.      (quota), hard limit, and time limit.  The soft limit is the number of 1K
  32.      blocks (or files) that the user is expected to remain below.  The hard
  33.      limit cannot be exceeded.  If a user's usage reaches the hard limit,
  34.      further requests for space (or attempts to create a file) fail with an
  35.      EDQUOT/ENOSPC error.
  36.  
  37.      When a user exceeds the soft limit, the timer is enabled.  Any time the
  38.      quota drops below the soft limits, the timer is disabled.  If the timer
  39.      pops, the particular limit that has been exceeded is treated as if the
  40.      hard limit has been reached, and no more resources are allocated to the
  41.      user.  The oooonnnnllllyyyy way to reset this condition, short of turning off limit
  42.      enforcement or increasing the limit, is to reduce usage below quota.
  43.      Only the superuser can set the time limits and this is done on a per
  44.      filesystem basis.
  45.  
  46.    SSSSuuuurrrrvvvviiiivvvviiiinnnngggg WWWWhhhheeeennnn tttthhhheeee QQQQuuuuoooottttaaaa LLLLiiiimmmmiiiitttt IIIIssss RRRReeeeaaaacccchhhheeeedddd
  47.      In most cases, the only way for a user to recover from over-quota
  48.      conditions is to abort whatever activity is in progress on the filesystem
  49.      that has reached its limit, remove sufficient files to bring the limit
  50.      back below quota, and retry the failed program.
  51.  
  52.      However, if a user is in the editor and a write fails because of an over
  53.      quota situation, that is not a suitable course of action.  It is most
  54.      likely that initially attempting to write the file has truncated its
  55.      previous contents, so if the editor is aborted without correctly writing
  56.      the file, not only are the recent changes lost, but possibly much, or
  57.      even all, of the contents that previously existed.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. qqqquuuuoooottttaaaassss((((4444))))                                                            qqqquuuuoooottttaaaassss((((4444))))
  71.  
  72.  
  73.  
  74.      There are several possible safe exits for a user caught in this
  75.      situation.  He can use the editor !!!! shell escape command to examine his
  76.      file space and remove surplus files.  Alternatively, using _c_s_h(1), he can
  77.      suspend the editor, remove some files, then resume it.  A third
  78.      possibility is to write the file to some other filesystem (perhaps to a
  79.      file on /_t_m_p) where the user's quota has not been exceeded.  Then after
  80.      rectifying the quota situation, the file can be moved back to the
  81.      filesystem it belongs on.
  82.  
  83.    AAAAddddmmmmiiiinnnniiiisssstttteeeerrrriiiinnnngggg tttthhhheeee QQQQuuuuoooottttaaaa SSSSyyyysssstttteeeemmmm
  84.      QQQQuuuuoooottttaaaassss is an lbootable subsystem that can be installed by the
  85.      administrator.  A decision as to what filesystems need to have quotas
  86.      enabled needs to be made.  Usually, only filesystems that house users'
  87.      home directories or other user files need to be subjected to the quota
  88.      system.  If possible, /_t_m_p should be free of quotas.
  89.  
  90.      XFS and EFS quota systems share many characteristics. However, overall
  91.      XFS offers a richer set of functionalities. We will explain the old EFS
  92.      quota system first and differences in XFS afterwards.
  93.  
  94.    AAAAddddmmmmiiiinnnniiiisssstttteeeerrrriiiinnnngggg tttthhhheeee EEEEFFFFSSSS QQQQuuuuoooottttaaaa SSSSyyyysssstttteeeemmmm
  95.      On EFS filesystems, a file by the name of _q_u_o_t_a_s should be created in the
  96.      root of the filesystems that are to have quotas.  This file should be of
  97.      size zero and should be writable only by root.  After deciding on the
  98.      filesystems that will have quotas, the administrator then establishes
  99.      quotas for individual users.  The _e_d_q_u_o_t_a(1M) command is used to actually
  100.      set the limits desired upon each user.  Where a number of users are to be
  101.      given the same quotas (a common occurrence) the ----pppp option to _e_d_q_u_o_t_a
  102.      allows this to be easily accomplished.  Unless explicitly given a quota,
  103.      users have no limits set on the amount of disk they can use or the number
  104.      of files they can create.
  105.  
  106.      Once the quotas are set and ready to operate, the system must be informed
  107.      to enforce quotas on the desired filesystems.  This is accomplished with
  108.      the _q_u_o_t_a_o_n(1M) command.  For quotas to be accurate, it should be enabled
  109.      on a local filesystem immediately after the filesystem has been mounted.
  110.      _q_u_o_t_a_o_n either enables quotas for a particular filesystem or, with the ----aaaa
  111.      option, enables quotas for each filesystem indicated in /_e_t_c/_f_s_t_a_b as
  112.      using quotas.  See _f_s_t_a_b(4) for details.  When the quotas subsystem is
  113.      installed,
  114.  
  115.           /usr/etc/quotaon -a
  116.  
  117.      can be automatically executed during system boot up time by /_e_t_c/_r_c_2.
  118.      The script /_e_t_c/_i_n_i_t._d/_q_u_o_t_a_s handles enabling of quotas and it uses the
  119.      _c_h_k_c_o_n_f_i_g(1M) command to check the qqqquuuuoooottttaaaassss configuration flag to decide
  120.      whether or not to enable quotas.  Users can circumvent the quotas
  121.      mechanism by giving the files away to other users with the use of
  122.      _c_h_o_w_n(1) or _c_h_o_w_n(2).  The system administrator can prevent this by
  123.      setting the variable _r_e_s_t_r_i_c_t_e_d__c_h_o_w_n to a non-zero value (see _i_n_t_r_o(2)
  124.      and _l_b_o_o_t(1M)).
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. qqqquuuuoooottttaaaassss((((4444))))                                                            qqqquuuuoooottttaaaassss((((4444))))
  137.  
  138.  
  139.  
  140.      When quotas need to be disabled, the _q_u_o_t_a_o_f_f(1M) command is used.
  141.      However, if the filesystem is about to be dismounted, the _u_m_o_u_n_t(1M)
  142.      command disables quotas immediately before the filesystem is unmounted.
  143.      This is actually an effect of the _u_m_o_u_n_t(2) system call, and it
  144.      guarantees that the quota system is not disabled if the _u_m_o_u_n_t would fail
  145.      because the filesystem is not idle.
  146.  
  147.      Periodically (certainly after each reboot and when quotas are first
  148.      enabled for a filesystem), the records retained in the quota file should
  149.      be checked for consistency with the actual number of blocks and files
  150.      allocated to the user.  The _q_u_o_t_a_c_h_e_c_k(1M) command is used to accomplish
  151.      this.  It is not necessary to dismount the filesystem or disable the
  152.      quota system to run this command, though on active filesystems inaccurate
  153.      results may occur.  This does no real harm in most cases; another run of
  154.      _q_u_o_t_a_c_h_e_c_k when the filesystem is idle corrects any inaccuracy.
  155.      _q_u_o_t_a_c_h_e_c_k can be run automatically during boot up via the script
  156.      /_e_t_c/_i_n_i_t._d/_q_u_o_t_a_s.  Since _q_u_o_t_a_c_h_e_c_k can take some time, there is a
  157.      _c_h_k_c_o_n_f_i_g flag called qqqquuuuoooottttaaaacccchhhheeeecccckkkk that controls whether or not to run
  158.      _q_u_o_t_a_c_h_e_c_k at system boot up time.
  159.  
  160.      The superuser can use the _q_u_o_t_a command to examine the usage and quotas
  161.      of any user, and the _r_e_p_q_u_o_t_a(1M) command can be used to check the usages
  162.      and limits for all users on a filesystem.
  163.  
  164.    AAAAddddmmmmiiiinnnniiiisssstttteeeerrrriiiinnnngggg tttthhhheeee XXXXFFFFSSSS QQQQuuuuoooottttaaaa SSSSyyyysssstttteeeemmmm
  165.      The XFS quota system is different from that of EFS in many ways.
  166.  
  167.      oooo    There is no necessity for a _q_u_o_t_a_s file in the root of the XFS
  168.           filesystem.
  169.  
  170.      oooo    XFS distinguishes between quota accounting and limit enforcement.
  171.           Quota accounting must be turned on at the time of mounting the XFS
  172.           filesystem.  However, it is possible to turn on/off limit
  173.           enforcement any time quota accounting is turned on. The qqqquuuuoooottttaaaa option
  174.           in _f_s_t_a_b(4) (or ----oooo qqqquuuuoooottttaaaa in _m_o_u_n_t(1M) ) turns on both quota
  175.           accounting and enforcement. The qqqqnnnnooooeeeennnnffffoooorrrrcccceeee option must be used to
  176.           turn on accounting with limit enforcement disabled.  _q_u_o_t_a_o_n(1M)
  177.           contains some examples of frequently used procedures.
  178.  
  179.      oooo    Turning on quotas on the root filesystem is slightly different from
  180.           the above.  _q_u_o_t_a_o_n(1M) must be used on the root XFS filesystem
  181.           first; quotas will be turned on the next time the system is
  182.           rebooted.  It is useful to use _r_e_p_q_u_o_t_a(1M) with the ----ssss option to
  183.           monitor the effect of _q_u_o_t_a_o_n/_o_f_f at various stages.
  184.  
  185.      oooo    _q_u_o_t_a_c_h_e_c_k(1M) has no effect on XFS filesystems. The first time
  186.           quota accounting is turned on, XFS does an automatic quotacheck
  187.           internally; afterwards, the quota system will always be completely
  188.           consistent until quotas are manually turned off.  Similarly,
  189.           /_e_t_c/_c_h_k_c_o_n_f_i_g(1M) options qqqquuuuoooottttaaaassss and qqqquuuuoooottttaaaacccchhhheeeecccckkkk are not needed for
  190.           XFS filesystems.
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. qqqquuuuoooottttaaaassss((((4444))))                                                            qqqquuuuoooottttaaaassss((((4444))))
  203.  
  204.  
  205.  
  206.      oooo    _r_e_p_q_u_o_t_a(1M) with the ----ssss option can be used to monitor the status of
  207.           the quota system of an XFS filesystem.  This can be used to see if
  208.           quotas are turned on, given an XFS filesystem.  It can also be used
  209.           to monitor the space occupied by the quota system itself.
  210.  
  211.      oooo    _r_e_p_q_u_o_t_a also provides a ----eeee option to output the limits of all users
  212.           listed in /_e_t_c/_p_a_s_s_w_d to a file that can later be read in by
  213.           _e_d_q_u_o_t_a(1M).  This is useful in recreating the limits of a large
  214.           number of users. A possible scenario would be ((((aaaa)))) creating the
  215.           output file using _r_e_p_q_u_o_t_a, ((((bbbb)))) turning off quotas and deleting all
  216.           the quota information (including limits, etc), ((((cccc)))) mounting the XFS
  217.           filesystem back with quotas turned on, and ((((dddd)))) reading that file
  218.           containing limits of users using _e_d_q_u_o_t_a.  This procedure will help
  219.           compact the quota information. Keeping all the limits saved in a
  220.           file for later use will also help in case of a disaster because
  221.           quota information cannot be backed up using _x_f_s_d_u_m_p(1M) or any other
  222.           backup utility.
  223.  
  224.      oooo    _e_d_q_u_o_t_a(1M) cannot be used to set quota limits before turning on
  225.           quotas on the filesystem concerned.
  226.  
  227.      oooo    XFS filesystems keep quota accounting on the superuser, and _q_u_o_t_a ----vvvv
  228.           will display the superuser's usage information. However, limits are
  229.           never enforced on the superuser.
  230.  
  231.      oooo    XFS filesystems keep quota accounting whether the user has quota
  232.           limits or not.
  233.  
  234.    QQQQuuuuoooottttaaaa IIIImmmmpppplllleeeemmmmeeeennnnttttaaaattttiiiioooonnnn NNNNooootttteeeessss
  235.      On EFS filesystems, disk quota usage information is stored in a file on
  236.      the filesystem that the quotas are to be applied to.  Conventionally,
  237.      this file is called _q_u_o_t_a_s, and resides at the root of the filesystem.
  238.      While this name is not known to the system in any way, several of the
  239.      user level utilities "know" it, and choosing any other name is not wise.
  240.  
  241.      The data in the quotas file is stored in a format different from
  242.      Berkeley's implementation.  Any direct accesses to the file by programs
  243.      is not recommended.  Instead, use the commands or the _q_u_o_t_a_c_t_l(2) system
  244.      call to access or modify the quota information.
  245.  
  246.      The system is informed of the existence of the quota file by the _q_u_o_t_a_c_t_l
  247.      system call.  It then reads the quota entries for any open files owned by
  248.      users.  Each subsequent open of a file in the filesystem is accompanied
  249.      by a pairing with its quota information.  In memory, the quota
  250.      information is kept hashed by user ID and filesystem and retained in an
  251.      LRU chain so recently released data can be easily reclaimed.
  252.  
  253.      Each time a block is accessed or released and each time an inode is
  254.      allocated or freed, the quota system gets told about it and, in the case
  255.      of allocations, gets the opportunity to deny the allocation.
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. qqqquuuuoooottttaaaassss((((4444))))                                                            qqqquuuuoooottttaaaassss((((4444))))
  269.  
  270.  
  271.  
  272.      Note that the XFS quota system implementation is radically different from
  273.      that of EFS described above. XFS considers quota information as
  274.      filesystem metadata and uses journalling to provide a higher level
  275.      guarantee of consistency.  Among other things, it is worth mentioning
  276.      that XFS can keep accounting information for a very large number of
  277.      active users efficiently.
  278.  
  279. BBBBUUUUGGGGSSSS
  280.      Currently, it is not possible to enable quotas on XFS realtime
  281.      filesystems.
  282.  
  283. FFFFIIIILLLLEEEESSSS
  284.      /etc/init.d/quotas       script to enable and disable quotas
  285.      /etc/rc2.d/S14quotas     linked to /_e_t_c/_i_n_i_t._d/_q_u_o_t_a_s
  286.      /etc/config/quotas       _c_h_k_c_o_n_f_i_g flag
  287.      /etc/config/quotacheck   _c_h_k_c_o_n_f_i_g flag
  288.  
  289. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  290.      mount(1M), chkconfig(1M), edquota(1M), quota(1), quotacheck(1M), rc2(1M),
  291.      repquota(1M), quotactl(2), fstab(4).
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.